Skip to content

Remember menu cursor position when navigating back from a submenu - #703

Closed
berendkleinhaneveld wants to merge 1 commit into
omacom:quattrofrom
berendkleinhaneveld:fix/menu-remember-selection
Closed

berendkleinhaneveld wants to merge 1 commit into
omacom:quattrofrom
berendkleinhaneveld:fix/menu-remember-selection

Conversation

@berendkleinhaneveld

Copy link
Copy Markdown

Problem

When navigating the Omarchy Menu (Super+Space) with arrow keys, drilling into a submenu and then going back (Left/Backspace) resets the cursor to the top of the parent list instead of returning to the item you were on. This makes exploring the menu harder for new users.

Fix

The navigation stack previously stored only the parent menu id. It now records the selected row index alongside it when entering a submenu, and goBack() restores that index when returning to the parent menu.

  • shell/plugins/menu/Menu.qml:
    • navStack entries are now { menu, selectedIndex } objects
    • setActiveMenu() saves the current selectedIndex when pushing history, and accepts an optional restoreIndex parameter
    • goBack() passes the remembered selectedIndex when returning to the parent menu
  • test/shell.d/menu-test.sh: three new assertions covering save/restore behavior

Verification

  • All menu shell tests pass (test/shell.d/menu-test.sh and related menu suites)
  • Full ./test/shell run: only pre-existing, environment-specific failures (identical on clean quattro)
  • qmllint warning count unchanged (188 before and after)

Drilling into a submenu pushed only the menu id onto the navigation
stack, so going back reset the cursor to the top of the parent list.
The stack now records the selected row alongside the menu id, and
goBack restores it, keeping the cursor where the user left it.
@berendkleinhaneveld

Copy link
Copy Markdown
Author

Closing in favor of the upstream fix. This repo is a fork of omacom/omarchy, and the menu code — including this bug — is inherited from there. The same fix already exists upstream, where several PRs compete:

The best-conditioned one is omacom/omarchy#12644 ("Return the menu cursor to the entered row when going back"):

  • restores the cursor to the nearest visible row by walking up from the opened item, which also covers Back from a deep search result and a menu opened straight into a submenu (cases this PR's index-based restore misses)
  • includes tests in test/shell.d/menu-test.sh
  • merges cleanly and carries the verified and ready labels after being reproduced on an Omarchy ISO worker

Once omacom#12644 is merged upstream, this fork can pick it up by merging omacom/omarchy's quattro branch, so no fork-local fix is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant